/*圆角背景框*/
import 'package:flutter/cupertino.dart';
import 'package:frametrim/utility/screen.dart';

class BackgroundView extends StatelessWidget {
  late Color mColor;
  late double mRadius;
  late double? mWidth;
  late double? mVerticalTopMargin;
  late double? mVerticalBottomMargin;
  late double? mHorizontalMargin;

  late double? mHorizontalPadding;
  late double? mVerticalPadding;
  late Widget widget;
  late GlobalKey? globalKey =GlobalKey();

  BackgroundView({
    this.mColor = const Color(0xFFffffff),
    this.mVerticalTopMargin = 10,
    this.mVerticalBottomMargin = 10,
    this.mHorizontalMargin = 12,
    this.mHorizontalPadding = 10,
    this.mVerticalPadding = 10,
    this.mRadius = 8,
    required this.widget,
    this.globalKey,
    this.mWidth,
  });


  @override
  Widget build(BuildContext context) {
    return Container(
      key: globalKey,
      width: mWidth ?? Screen.width,
      margin: EdgeInsets.fromLTRB(mHorizontalMargin!, mVerticalTopMargin!, mHorizontalMargin!, mVerticalBottomMargin!),
      // margin: EdgeInsets.symmetric(horizontal: mHorizontalMargin!,vertical: mVerticalMargin! ),
      padding: EdgeInsets.symmetric(horizontal: mHorizontalPadding!,vertical: mVerticalPadding! ),
      decoration: BoxDecoration(
          color: mColor,
          borderRadius: BorderRadius.all(Radius.circular(mRadius))),
      child: widget,
    );
  }
}
